<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增站点')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-site-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">站点名称：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">站点地址：</label>
                <div class="col-sm-8">
                    <input name="sitePath" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">模板主题id：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="themeId" name="themeId"  type="hidden"/>
                        <input class="form-control" type="text" onclick="selectThemeTree()" id="themeName" readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/site"
        $("#form-site-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-site-add').serialize());
            }
        }

        /*模板主题选择*/
        function selectThemeTree() {
            var options = {
                title: '模板主题选择',
                width: "380",
                url: ctx + "system/theme" + "/selectThemeTree/",
                callBack: doSubmitThemeTree
            };
            $.modal.openOptions(options);
        }

        function doSubmitThemeTree(index, layero){
            var body = layer.getChildFrame('body', index);
            $("#themeId").val(body.find('#treeId').val());
            $("#themeName").val(body.find('#treeName').val());
            layer.close(index);
        }

    </script>
</body>
</html>